package com.ruoyi.information.controller.pc;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.information.domain.pc.Cooperate;
import com.ruoyi.information.service.pc.ICooperateService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 商务合作Controller
 *
 * @author ruoyi
 * @date 2023-07-14
 */
@RestController
@RequestMapping("/cooperate")
public class CooperateController extends BaseController
{
    @Autowired
    private ICooperateService cooperateService;

    /**
     * 查询商务合作列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Cooperate cooperate)
    {
        startPage();
        List<Cooperate> list = cooperateService.selectCooperateList(cooperate);
        return getDataTable(list);
    }


    /**
     * 获取商务合作详细信息
     */
    @GetMapping(value = "/getOne")
    public AjaxResult getInfo()
    {
        return success(cooperateService.selectCooperateById());
    }

    /**
     * 新增商务合作
     */
    @PostMapping
    public AjaxResult add(@RequestBody Cooperate cooperate)
    {
        return toAjax(cooperateService.insertCooperate(cooperate));
    }

    /**
     * 修改商务合作
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Cooperate cooperate)
    {
        return toAjax(cooperateService.updateCooperate(cooperate));
    }

    /**
     * 删除商务合作
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cooperateService.deleteCooperateByIds(ids));
    }
}
